The following commands are used to set up document parameters and to display printin dialogs:
doPageSetup Presents the Page Setup dialog
doJobSetup Presents the Print Job Setup dialog
setLandscapeMode Sets landscape or portrait orientation
setMargins Sets the margins of the
setDocumentName Sets the name of the document
doPageSetup
Syntax: doPageSetup(document)
Returns: TRUE if the user clicks "OK" in the page setup dialog
FALSE if the user clicks "Cancel" in the page setup dialog
The doPageSetup function displays the Page Setup dialog for a document. This function must be called on an empty document, before any elements are added to it. doPageSetup returns TRUE if the user clicks the "OK" button in the dialog box, or FALSE if the user clicks "Cancel". You can call the getLandscapeMode routine before and after doPageSetup to determine if the user changed the page orientation in the Page Setup dialog box.
doJobSetup
Syntax: doJobSetup(document)
Returns: TRUE if the user clicks "Print" in the job setup dialog
FALSE if the user clicks "Cancel" in the job setup dialog
The doJobSetup function displays the job setup dialog for a document object. This function should be called right before printing. If doJobSetup returns TRUE, the user clicked the "Print" button, and printing should proceed. If doJobSetup returns FALSE, the user clicked "Cancel", and you should not print the document. This function cannot be called on an empty document.
Example:
This is the recommended way of calling doJobSetup right before printing a PrintOMatic document:
if doJobSetup (doc) = TRUE then print doc
setLandscapeMode
Syntax: setLandscapeMode document, trueOrFalse
This command switches the page orientation of a document object between landscape and portrait orientation. Since this method changes the whole coordinate system of the document, your document must be empty when you call setLandscapeMode. You can call reset on your document beforehand just to make sure.
Windows and Mac OS X
In Windows and Mac OS X, this method works in a very straightforward manner: call it, and the landscape mode changes.
Mac OS 9 / Classic Mac OS
Unfortunately, it's an entirely different story on Mac OS 9 / Classic Mac OS. The only safe way to change the page orientation on the Mac is by showing the Page Setup dialog and letting the user manually select landscape mode. While showing a Page Setup dialog may be fine for normal software applications such as Word, it's often unacceptable in the context of a multimedia production.
To get around this, PrintOMatic for Mac OS 9 relies on a "printer database" to store default landscape and portrait page setups for the most common Macintosh printers. This printer database consists of a set of 'PHDL' resources located in the same file as the PrintOMatic Xtra. This database is used by the setLandscapeMode method in the Macintosh version of PrintOMatic.
If the currently selected printer is not found in the printer database, the user is asked to MANUALLY create default Page Setups for landscape and portrait modes, and those settings are saved and added to the database. This is done through a series of prompt dialogs presented automatically by PrintOMatic when you call setLandscapeMode for an unknown printer.
These user-configured "custom entries" to the printer database are stored in a file called "PrintOMatic Preferences" in the Preferences folder on the user's hard disk. Subsequent calls to setLandscapeMode on the same computer, with the same printer selected, won't present any annoying dialogs.
What the presence of this "printer database" means is that when you change the landscape mode on the Macintosh, all the other Page Setup settings such as scaling, font substitution, etc., will also revert to those found in the printer database. This is important if the user has changed any of these settings (during a call to doPageSetup) before setLandscapeMode is called.
setMargins
Syntax: setMargins document, marginRect
This command sets the margins of a document object. The marginRect parameter is in the form of a Lingo Rect. Values are specified in the format Rect(left, top, right, bottom). The measurements are in points (72 points to the inch). Since this method changes the whole coordinate system of the document, your document must be empty when you call setMargins. Call reset on your document beforehand just to make sure.
Example:
The following example creates a new document and sets the margins to two inches (144 points) on the left, and one inch (72 points) on all other sides.
set doc = new(xtra "PrintOMatic")
if not objectP(doc) then exit
setMargins doc, Rect(144,72,72,72)
setDocumentName
Syntax: setDocumentName document, name
This command sets the name of a PrintOMatic document, which is displayed in the print progress dialog as the document prints. If background printing is enabled, this document name is also displayed by PrintMonitor (Mac) or Print Manager (Windows) as your document prints in the background.